import com.lzh.pojo.Account;
import com.lzh.service.AccountService;
import com.lzh.service.Impl.AccountServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
import java.util.logging.Logger;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class Debugtest {

    @Autowired
     private AccountService accountService;


   @Test
     public void test1() throws Exception{
        for (Account account:accountService.selectAllAccount()){
            System.out.println(account);
        }
     }


   /*@Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        AccountService accountService = (AccountService) context.getBean("AccountServiceImpl");
        for (Account account:accountService.selectAllAccount()){
            System.out.println(account);
        }
    }*/
   /*@Test
    public void testdelete(){
       accountService.deleteById(3);
   }*/
   /*@Test
    public void  testSelectBYId(){
       Account account = accountService.selectById(3);
       System.out.println(account);

   }*/
   /*@Test
    public  void addtest(){
       Account account = new Account();
       account.setId(6);
       account.setName("扇子");
       account.setMoney("10");
       System.out.println(account);
       int i = accountService.addAcount(account);
       if (i == 1){
           System.out.println("添加成功");
       }
   }*/
/*   @Test
   public void testUpdate(){
       Account account = new Account();
       account.setId(1);
       account.setName("战斗");
       account.setMoney("100");
       int i = accountService.updateAccount(account);
       if(i==1){
           System.out.println("Update Success!");
       }
   }*/
}
